package leetcode.weekly.week314;

//Solution2Test
public class Solution2 {

	public int[] findArray(int[] pref) {
		int n = pref.length;
		int[] ans = new int[n];
		ans[0] = pref[0];
		int sum = ans[0];
		for (int i = 1; i < pref.length; i++) {
			ans[i] = pref[i] ^ sum;
			sum ^= ans[i];
		}
		return ans;
	}

}
